﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace odinshrine
{
    enum Elts_T
    {
        Simple,
        Plateform
    }
    enum Elts_P
    {
        None,
        Bot,
        Top,
        All
    }

    class Elements
    {
        public SpriteManager sprte_e;
        public Elts_P passability;
        public char id;
        private int indicator;
        public int structIndic;
        public Elts_T type;

        public Elements(Texture2D sprite, char id,Elts_T type,Elts_P passability )
        {
            if (type == Elts_T.Plateform)
            {
                indicator = 3;
            }
            else
            {
                indicator = 1;
            }
            sprte_e = new SpriteManager();
            sprte_e.Load(sprite, 1, indicator);
            sprte_e.AjoutAnimation("Mid",1,1);
            if (type == Elts_T.Plateform)
            {
                sprte_e.AjoutAnimation("Left", 2, 1);
                sprte_e.AjoutAnimation("Right", 3, 1);
            }
            this.passability = passability;
            this.id = id;
            this.type = type;
            this.sprte_e.ChangeAnime("Mid", true);
        }

        public Elements(Elements elt)
        {
         this.sprte_e = new SpriteManager(elt.sprte_e);
         this.passability = elt.passability;
         this.id = elt.id;
         this.indicator = elt.indicator;
         this.structIndic = elt.structIndic;
         this.type = elt.type;
        }

        public void Draw(SpriteBatch spriteBatch, int x, int y)
        {
            spriteBatch.Draw(sprte_e.texture, new Rectangle((int)x, (int)y, (int)(sprte_e.width * sprte_e.scale), (int)(sprte_e.height * sprte_e.scale)), sprte_e.Animations[sprte_e.SpriteAnime].Rectangles[sprte_e.FrameIndex],
                sprte_e.Animations[sprte_e.SpriteAnime].Color, sprte_e.Rotation, sprte_e.Origin, sprte_e.SpriteEffect,
                0f);
        }


    }
}
